ptacr <- read_delim("ttest_aid_allocation_bonferroni.txt",
"\t", escape_double = FALSE, trim_ws = TRUE)
library(stringr)
library(dplyr)
library(ggplot2)
library(grid)
library(gtable)
# Import Data
library(readr)
setwd("/Users/b1010576/Dropbox (Uni Sbg Politikwiss.)/Donor Behavior Survey Experiment/do files/Replication_JOP/Input_Figures_Appendix")
ptacr <- read_delim("ttest_aid_allocation_bonferroni.txt",
"\t", escape_double = FALSE, trim_ws = TRUE)
# Create intervals
clo <- ptacr$dif - 1.96*ptacr$se
chi <- ptacr$dif + 1.96*ptacr$se
#Create categories
ptacr$categories <- c(rep("Humanitarian",3),
rep("Transitional",3),
rep("Development",3),
rep("Budgetary",3)
)
ptacr$categories <- factor(ptacr$categories,
levels = c( "Humanitarian",
"Transitional",
"Development",
"Budgetary"))
# Create new labels
ptacr$labels <- c("Strong Violence", "Mild Violence", "Mild Peace" ,
"Strong Violence", "Mild Violence", "Mild Peace",
"Strong Violence", "Mild Violence", "Mild Peace",
"Strong Violence", "Mild Violence",
"Mild Peace")
ptacr$labels <- factor(ptacr$labels,
levels = c("Mild Peace", "Mild Violence",  "Strong Violence",
"Mild Peace", "Mild Violence",  "Strong Violence",
"Mild Peace", "Mild Violence",  "Strong Violence",
"Mild Peace", "Mild Violence",  "Strong Violence"))
category_shortnames <- c(
`Humanitarian` = "Humanitarian",
`Transitional` = "Transitional",
`Development` = "Development",
`Budgetary` = "Budgetary"
)
##########################################################################
# Plot
base <- ggplot(ptacr, aes(y = ptacr$labels, x = ptacr$dif,
group=ptacr$categories)) +
geom_point(size=1.5) +
geom_errorbarh(aes(xmax = clo, xmin = chi, height = 0)) +
theme_bw() +
geom_vline(xintercept = 0, colour = "black", linetype = 2, size = .7) +
facet_grid(categories ~ ., labeller = as_labeller(category_shortnames),
scales  ="free_y", space = "free_y", switch = "both") +
scale_y_discrete(position="right") +
theme(plot.background = element_rect(fill = 'grey95'),
axis.text.x = element_text(size=11, color = "black"),
axis.text.y = element_text(size=8.5, color = "black"),
strip.text.y = element_text(angle = 180, color = "grey15", size = 8.5),
strip.background = element_rect(fill = 'grey85')) +
theme(axis.title.y = element_blank(),
plot.margin=unit(c(1,1,1,3),"line")) +
#scale_x_continuous(labels = c("-2","-1","-0.5","0","0.5", "1", "1.5")) +
scale_x_continuous(limits=c(-1.5, 1.5)) +
xlab("Difference in Means (Baseline: Strong Peace) - Bonferroni Correction")
# Render plot
plot <- ggplotGrob(base)
# Final plot
grid.newpage()
grid.draw(plot)
